package com.ror.java.se.io;

import java.io.FileOutputStream;
import java.io.IOException;

/*
    早期处理IOException：在finally中手动释放资源
 */

public class Demo05IOEinEarly {
    public static void main(String[] args) {
        FileOutputStream fo = null;
        try {
            fo = new FileOutputStream("assets/io/byte/c.txt");
            fo.write(new byte[]{97, 98, 99, 100, 101}, 1, 2); //bc
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fo != null)
                try {
                    fo.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
    }
}
